package com.itheima.utils;

public class CurrentHolder {
    // 定义ThreadLocal变量，存储Integer类型的员工ID
    private static final ThreadLocal<Integer> CURRENT_LOCAL = new ThreadLocal<>();
    // 设置当前线程的员工ID
    public static void setCurrentId(Integer employeeId) {

        CURRENT_LOCAL.set(employeeId);
    }
    // 获取当前线程的员工ID
    public static Integer getCurrentId() {

        return CURRENT_LOCAL.get();
    }
    // 移除当前线程的员工ID（防止内存泄漏）
    public static void remove() {

        CURRENT_LOCAL.remove();
    }
}
